package library_management.operation.impl;

import library_management.book.BookList;
import library_management.operation.IOperation;

public class ReturnOperation implements IOperation {
    @Override
    public void work(BookList bookList) {
        System.out.println("=====================================");
        System.out.println("您当前正在进行归还操作");
        System.out.println("请输入您要归还的书目：");
        String returnBook=scanner.next();
        if(bookList.isContains(returnBook))
        {
            if(bookList.isBookBorrow(returnBook))
            {
                bookList.returnBook(returnBook);
                System.out.println("还书成功！");
            }
            else
            {
                System.out.println("这本书暂未借出，无需归还！");
            }
        }
        else
        {
            System.out.println("很抱歉这不是我们图书馆的书籍~");
        }
    }
}
